/* ClientThread.java 
* Created on Dec 11, 2012 
*@Author: Mr.Viet 
*@Phone: 01683430426 
*@Email: phamvanvietcdhd@gmail.com
*/ 
package com.chat; 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

import javax.swing.JTextArea;

public class ClientThread extends Thread{
	
	private Socket socket;
	private BufferedReader buff;
	private PrintWriter out;
	private boolean running = true;
	private JTextArea txtContent;
	private ClientApp ca;
	
	public ClientThread(ClientApp ca, Socket socket, JTextArea txtContent){
		this.socket = socket;
		this.txtContent = txtContent;
		this.ca = ca;
		try {
			this.buff = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
			this.out = new PrintWriter(this.socket.getOutputStream());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	@Override
	public void run() {
		while(running){
			String str = null;
			try {
				while((str=buff.readLine())!=null){
					String[] strItems = str.split("##");
					String type = strItems[0];
					if(type.equals("server")){
						String cmd = strItems[1];
						if(cmd.equals(ServerApp.TYPE_LOGIN_APP)){
							
						}
					}
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
